<?php 
namespace Admin\Model;
use Think\Model;

class OrderListModel extends Model{
	//查询总条数
	public function getCount()
	{
		$total=$this->table('order_list ol,user u,address ad')
			->where("ol.uid=u.id and ol.add_id=ad.id")
			->count();
		//echo $total;exit;
		return $total;
		}
	public function getAll($limit){
		$list=$this->field('ol.id 		    olid,ol.ordernumber  olo,ol.is_pay       olpay,ol.is_delivery  olde,ad.address 		adad,ad.receiver	adre,ad.tel 			adtel,u.username 		uname,ol.ordertime 	oltime ')
		->table('order_list      ol,
				user 			u,
				address 		ad')
		->where("ol.add_id=ad.id
		   	and
		    	ol.uid=u.id")
		->order('ol.ordertime desc')
		->limit($limit)
		->select();
		return $list;
		//var_dump($list);exit;
	}

}
?>